﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IOEntity;
using IODataAccess;

namespace IOBusiness
{
    public class clsBSTheLoai
    {
        public List<clsTheLoai> GetByQuocGia(int id)
        {
            clsDATheLoai d = new clsDATheLoai();
            return d.GetByQuocGia(id);
        }
        public clsTheLoai GetById(int id)
        { 
            clsDATheLoai d = new clsDATheLoai();
            return d.GetById(id);
        }
        public List<clsTheLoai> GetByQuocGia(int id,int danhmuc)
        {
            clsDATheLoai d = new clsDATheLoai();
            List<clsTheLoai> dm = new List<clsTheLoai>();
            dm=d.GetByQuocGia1(id);
            for (int i = 0; i < dm.Count; i++)
            {
                if (dm[i].DanhMuc.Id != danhmuc)
                {
                    dm.RemoveAt(i);
                    i--;
                }
            }
            return dm;
        }
        public bool InsertTL(clsTheLoai dm)
        {
            clsDATheLoai d = new clsDATheLoai();
            return d.InsertTL(dm);
        }
        public bool EditTL(clsTheLoai dm)
        {
            clsDATheLoai d = new clsDATheLoai();
            return d.EditTheLoai(dm);
        }
        public bool EditTLND(clsTheLoai dm)
        {
            clsDATheLoai d = new clsDATheLoai();
            return d.EditTheLoaiNoiDung(dm);
        }
        public bool DelTL(clsTheLoai dm)
        {
            clsDATheLoai d = new clsDATheLoai();
            return d.DeleteTheLoai(dm);
        }

    }
}
